package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by hedepu on 2017-08-30
 * 参数名	必选	类型	说明
 * session	是	string	登录session
 * page	是	string	页数
 * size	是	string	每页条数
 * storeId	是	string	门店ID
 * serviceName
 */

public class OrderSelectBespokeSelectApi extends BaseApi {
    private String session;
    private String storeId;
    private String page;
    private String size;
    private String serviceName;


    public OrderSelectBespokeSelectApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setShowProgress(false);
        setCache(false);
        setMothed(UserHelper.getInstance().getUserAccount() + Constants.OWN_ORDER_SERVICELIST);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(24 * 60 * 60 * 7);//无网缓存7天
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getPage() {
        return page;
    }

    public void setPage(String page) {
        this.page = page;
    }

    public String getSize() {
        return size;
    }

    public void setSize(String size) {
        this.size = size;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getBespokeApi(getSession(), getStoreId(), getPage(), getSize(), getServiceName());
    }
}
